function SrvGroup(params){ 
	 
}

SrvGroup.Where = function(type,proxy){
	this.type = type;
	this.proxy=proxy;
	this.linked = null;
	this.set = null;
	if(this.type==0){
		this.set = new SrvGroup.Where(1,true);
		this.set.linked = this;
	}
	this.getProxy = function(){
		var m = new SrvGroup.Where(this.type);//当前的对像
		if(this.type==0){
			m.set = new SrvGroup.Where(1,true);//set对象
			m.set.linked = m;
		}else{
			m.linked=this.linked;
			this.linked.linked=m;
		}
		return m;
	}
	this.data = {};
	this.put = function(key,value){
		this.data[key] = value;
	}
	this.get = function(key){
		return this.data[key];
	}
	
	
	/** 编号 [非空]       **/
	this.sgId=function(sgId){if(this.proxy)return this.getProxy().sgId(sgId);  this.put("sgId", sgId);return this;};
	/** and sg_id is null */
	this.sgIdNull=function(){if(this.proxy)return this.getProxy().sgIdNull();if(this.get("sgIdNot")==null)this.put("sgIdNot", "");this.put("sgId", null);return this;};
	/** not .... */
	this.sgIdNot=function(){if(this.proxy)return this.getProxy().sgIdNot();this.put("sgIdNot", "not");return this;};
	this.sgIdNotNull=function(){if(this.proxy)return this.getProxy().sgIdNotNull();this.put("sgIdNot", "not");this.put("sgId", null);return this;};
	this.sgIdNot=function(sgId){if(this.proxy)return this.getProxy().sgIdNot(sgId);this.put("sgIdNot", "not");this.put("sgId", sgId);return this;};
		
	/** and sg_id <= ? */
	this.sgIdMin=function(min){if(this.proxy)return this.getProxy().sgIdMin(min);this.put("sgIdMin", min);return this;};
	/** and sg_id >= ? */
	this.sgIdMax=function(max){if(this.proxy)return this.getProxy().sgIdMax(max);this.put("sgIdMax", max);return this;};
		
		
	this.sgIdIn=function(ids){
		if(this.proxy)return this.getProxy().sgIdIn(ids);  this.put("sgIdIn", ids);return this;
	};	
		 
	
	
	/** 组名称 [非空]       **/
	this.sgName=function(sgName){if(this.proxy)return this.getProxy().sgName(sgName);  this.put("sgName", sgName);return this;};
	/** and sg_name is null */
	this.sgNameNull=function(){if(this.proxy)return this.getProxy().sgNameNull();if(this.get("sgNameNot")==null)this.put("sgNameNot", "");this.put("sgName", null);return this;};
	/** not .... */
	this.sgNameNot=function(){if(this.proxy)return this.getProxy().sgNameNot();this.put("sgNameNot", "not");return this;};
	this.sgNameNotNull=function(){if(this.proxy)return this.getProxy().sgNameNotNull();this.put("sgNameNot", "not");this.put("sgName", null);return this;};
	this.sgNameNot=function(sgName){if(this.proxy)return this.getProxy().sgNameNot(sgName);this.put("sgNameNot", "not");this.put("sgName", sgName);return this;};
		
		 
	
	
	/** 上级组 [非空] [SrvGroup]      **/
	this.sgParent=function(sgParent){if(this.proxy)return this.getProxy().sgParent(sgParent);  this.put("sgParent", sgParent);return this;};
	/** and sg_parent is null */
	this.sgParentNull=function(){if(this.proxy)return this.getProxy().sgParentNull();if(this.get("sgParentNot")==null)this.put("sgParentNot", "");this.put("sgParent", null);return this;};
	/** not .... */
	this.sgParentNot=function(){if(this.proxy)return this.getProxy().sgParentNot();this.put("sgParentNot", "not");return this;};
	this.sgParentNotNull=function(){if(this.proxy)return this.getProxy().sgParentNotNull();this.put("sgParentNot", "not");this.put("sgParent", null);return this;};
	this.sgParentNot=function(sgParent){if(this.proxy)return this.getProxy().sgParentNot(sgParent);this.put("sgParentNot", "not");this.put("sgParent", sgParent);return this;};
		
		
	this.sgParentIn=function(ids){
		if(this.proxy)return this.getProxy().sgParentIn(ids);  this.put("sgParentIn", ids);return this;
	};	
		 
	
	
	/** 族序列        **/
	this.sgFamily=function(sgFamily){if(this.proxy)return this.getProxy().sgFamily(sgFamily);  this.put("sgFamily", sgFamily);return this;};
	/** and sg_family is null */
	this.sgFamilyNull=function(){if(this.proxy)return this.getProxy().sgFamilyNull();if(this.get("sgFamilyNot")==null)this.put("sgFamilyNot", "");this.put("sgFamily", null);return this;};
	/** not .... */
	this.sgFamilyNot=function(){if(this.proxy)return this.getProxy().sgFamilyNot();this.put("sgFamilyNot", "not");return this;};
	this.sgFamilyNotNull=function(){if(this.proxy)return this.getProxy().sgFamilyNotNull();this.put("sgFamilyNot", "not");this.put("sgFamily", null);return this;};
	this.sgFamilyNot=function(sgFamily){if(this.proxy)return this.getProxy().sgFamilyNot(sgFamily);this.put("sgFamilyNot", "not");this.put("sgFamily", sgFamily);return this;};
		
		 
	
	
	/** 负责人  [SrvUser]     /admin/permissions/user.query.do **/
	this.sgUser=function(sgUser){if(this.proxy)return this.getProxy().sgUser(sgUser);  this.put("sgUser", sgUser);return this;};
	/** and sg_user is null */
	this.sgUserNull=function(){if(this.proxy)return this.getProxy().sgUserNull();if(this.get("sgUserNot")==null)this.put("sgUserNot", "");this.put("sgUser", null);return this;};
	/** not .... */
	this.sgUserNot=function(){if(this.proxy)return this.getProxy().sgUserNot();this.put("sgUserNot", "not");return this;};
	this.sgUserNotNull=function(){if(this.proxy)return this.getProxy().sgUserNotNull();this.put("sgUserNot", "not");this.put("sgUser", null);return this;};
	this.sgUserNot=function(sgUser){if(this.proxy)return this.getProxy().sgUserNot(sgUser);this.put("sgUserNot", "not");this.put("sgUser", sgUser);return this;};
		
		
	this.sgUserIn=function(ids){
		if(this.proxy)return this.getProxy().sgUserIn(ids);  this.put("sgUserIn", ids);return this;
	};	
		 
	
	
	/** 组标识        **/
	this.sgFlag=function(sgFlag){if(this.proxy)return this.getProxy().sgFlag(sgFlag);  this.put("sgFlag", sgFlag);return this;};
	/** and sg_flag is null */
	this.sgFlagNull=function(){if(this.proxy)return this.getProxy().sgFlagNull();if(this.get("sgFlagNot")==null)this.put("sgFlagNot", "");this.put("sgFlag", null);return this;};
	/** not .... */
	this.sgFlagNot=function(){if(this.proxy)return this.getProxy().sgFlagNot();this.put("sgFlagNot", "not");return this;};
	this.sgFlagNotNull=function(){if(this.proxy)return this.getProxy().sgFlagNotNull();this.put("sgFlagNot", "not");this.put("sgFlag", null);return this;};
	this.sgFlagNot=function(sgFlag){if(this.proxy)return this.getProxy().sgFlagNot(sgFlag);this.put("sgFlagNot", "not");this.put("sgFlag", sgFlag);return this;};
		
		 
	
	
	/** 状态 [非空]   1:启用 0:禁用     **/
	this.sgStatus=function(sgStatus){if(this.proxy)return this.getProxy().sgStatus(sgStatus);  this.put("sgStatus", sgStatus);return this;};
	/** and sg_status is null */
	this.sgStatusNull=function(){if(this.proxy)return this.getProxy().sgStatusNull();if(this.get("sgStatusNot")==null)this.put("sgStatusNot", "");this.put("sgStatus", null);return this;};
	/** not .... */
	this.sgStatusNot=function(){if(this.proxy)return this.getProxy().sgStatusNot();this.put("sgStatusNot", "not");return this;};
	this.sgStatusNotNull=function(){if(this.proxy)return this.getProxy().sgStatusNotNull();this.put("sgStatusNot", "not");this.put("sgStatus", null);return this;};
	this.sgStatusNot=function(sgStatus){if(this.proxy)return this.getProxy().sgStatusNot(sgStatus);this.put("sgStatusNot", "not");this.put("sgStatus", sgStatus);return this;};
		
		
	this.sgStatusIn=function(ids){
		if(this.proxy)return this.getProxy().sgStatusIn(ids);  this.put("sgStatusIn", ids);return this;
	};	
		 
	
	
	
	this.add=function(key,value) {if(proxy)return proxy().add(key,value);this.put(key, value);return this;}
	this.desc=function(sql) {if(proxy)return proxy().desc(sql);this.put("desc", sql);return this;}
	this.asc=function(sql) {if(proxy)return proxy().asc(sql);this.put("asc", sql);return this;}
	this.definex=function(sql) {if(proxy)return proxy().definex(sql);this.put("definex", sql);return this;}
	
	/** 获取所有组织部门 **/
	this.list=function(size){
		this.data.size = size;
		var protocol = ux.ajax("/admin/permissions/group.list.do",this.data);
		if(!protocol)return null;
		if(protocol.data && protocol.data.list)return protocol.data.list;
		return [];
	}
	/** 获取组织部门分页 **/
	this.page=function(page,size){
		this.data.size = size;
		this.data.page = page;
		var protocol = ux.ajax("/admin/permissions/group.list.do",this.data);
		if(!protocol)return null;
		if(protocol.data)return data;
		return {list:[]};
	}
	/** 根据查询条件取组织部门 **/
	this.get=function(){
		this.data.size = 1;
		var protocol = ux.ajax("/admin/permissions/group.list.do",this.data);
		if(!protocol)return null;
		if(protocol.data && protocol.data.list && protocol.data.list.length==1)return protocol.data.list[0]; 
		return null;
	}
}

SrvGroup.get = function(id){
	var protocol = ux.ajax("/admin/permissions/group.get.do",{id:id});
	if(!protocol)return null;
	if(protocol.data)return protocol.data.srvGroup;
	return null;
}

SrvGroup.where = new SrvGroup.Where(0,true);